<template>
	<view class="articles">
		<u-swiper :list="swiperList" name="img_url" height="320"></u-swiper>
		<article-item class="u-p-t-30" @itemClick="goDetail" :list="articlesList"></article-item>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//文章数组
				articlesList:[],
				
				//轮播图数组
				swiperList:[]
			}
		},
		methods: {
			//获取文章数据
			// async getArticles(){
			// 	const res = await this.$myRequest({
			// 		url:'/api/getnewslist'
			// 	})
			// 	this.articlesList = res.data.message
				
			// },
			//子传父 通过id到详情页
			goDetail(id){
				uni.navigateTo({
					url:'/pages/article-detail/article-detail?id='+id
				})
			}
		},
		
		onLoad(){
			this.getArticles()
		}
	}
</script>

<style lang="scss">
	.articles{
		
	}
</style>
